<template>
  <div>
    <div class="content" v-if="songList.length > 0">
    <h1 class="title">
      <slot name="title"></slot>
    </h1>
    <hr>
    <ul>
      <li class="list-title">
        <div class="song-item">
          <span class="item-index"></span>
          <span class="item-picture"></span>
          <span class="bofangbtn"></span>
          <span class="item-title">歌曲名</span>
          <span class="item-name">时长</span>
          <span class="item-intro">歌手</span>
        </div>
      </li>
      <li class="list-content" v-for="(item, index) in songList" :key="index">
        <div class="song-item" @click="toplay(item.id, item.songUrl, item.picture, index, item.name,item.singer.name ,item.lyric)">
          <span class="item-index">{{index + 1}}</span>
          <span class="item-picture">
            <v-img
            :src="item.picture"
            aspect-ratio="1"
            class="grey lighten-2"
            width="50px"
            height="50px"
          >
              <template v-slot:placeholder>
                    <v-layout
                      fill-height
                      align-center
                      justify-center
                      ma-0
                    >
                      <v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
                    </v-layout>
                  </template>
                </v-img>
          </span>
          <span class="bofangbtn">
            <svg-icon icon-class="bofang01">

            </svg-icon>
          </span>
          <span class="item-title">
            {{item.name}}
          </span>
          <span class="item-name">{{item.audioDuration}}</span>
          <span class="item-intro">{{item.singer.name}}</span>
        </div>
      </li>
    </ul>
  </div>
    <div v-else>
      <span class="noList">
        暂无歌曲
      </span>
    </div>
  </div>

</template>

<script>
import {mixin} from '../mixins'

/*
*AlbumContent  歌集内容
*
* 在歌单显示的歌集内容
* 1.songList已被赋值  songList = listOfsongs, listOfsong是ssessionStorage
*
* */
export default {
  name: 'album-content',
  props: [
    'songList'
  ],
  mixins: [mixin],

}
</script>

<style scoped>
  .noList {
    display: inline-block;
    font-size: 2.3em;
    margin-top: 50px;
    margin-left: 45%;
  }
  *{
    box-sizing: border-box;
  }
  .content {
    background-color: white;
    border-radius: 12px;
    padding: 20px 40px;
    min-width: 700px;
  }
  .content .title {
    text-align: center;
  }
  .content > ul {
    width: 100%;
    padding-bottom: 50px;
  }
  .content > ul > li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: block;
    height: 80px;
    line-height: 80px;
    text-indent: 20px;
  }
  .list-content {
    cursor: pointer;
  }
  .song-item {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    align-items: center;
    text-overflow:ellipsis;
    white-space: nowrap;
  }
  .list-content:hover {
    background-color: whitesmoke;
  }
  .item-index {
    width: 10%;
    margin-left: 10%;

  }
  .item-title {
    width: 20%;
  }
  .item-name {
    width: 20%;
  }
  .item-picture {
    width: 6%;
  }
  .item-intro {
    width: 20%;
  }
  .bofangbtn{
    width: 5%;
  }
</style>
